package com.jspgou.cms.dao;

import java.io.IOException;
import java.util.Date;
import java.util.HashSet;
import java.util.List;

import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexWriter;

import com.jspgou.common.hibernate3.Updater;
import com.jspgou.common.page.Pagination;
import com.jspgou.cms.entity.Product;
import com.jspgou.cms.entity.ProductTag;

public interface ProductDao {

	public Pagination getPageByCategory(Long ctgId, Long storeId,String productName,String brandName,
			Long source,Boolean Ontheshelf,Boolean Whetherban,
			Boolean Whetherpresale,Long typeId,Double startSalePrice,Double endSalePrice,
			Integer startStock,Integer endStock, int pageNo, int pageSize, boolean cacheable);

	public Pagination getPageByWebsite(Long webId,Long storeId,String productName,String brandName,
			Long storeCategoryId,Long source,Boolean Ontheshelf,Boolean Whetherban,
			Boolean Whetherpresale,Long typeId,Double startSalePrice,Double endSalePrice,
			Integer startStock,Integer endStock, int pageNo, int pageSize, boolean cacheable);

	public Pagination getPageByTag(Long storeId,Long tagId, Long ctgId,Long storeCategoryId,int pageNo, int pageSize, boolean cacheable);

	public List<Product> getListByCategory(Long ctgId,int firstResult, int maxResults,
			boolean cacheable);
	
	public List<Product> getListByStore(Long storeId,int firstResult, int maxResults,
			boolean cacheable);

	public List<Product> getListByWebsite(Long webId,int firstResult, int maxResults,
			boolean cacheable);

	public List<Product> getListByTag(Long tagId, Long ctgId,
			int firstResult,int maxResults, boolean cacheable);
	
	public List<Product> getList(Long storeId,Long typeId,Long brandId,String productName,boolean cacheable);

	public int luceneWriteIndex(IndexWriter writer, Long webId, Date start,
			Date end) throws CorruptIndexException, IOException;
	
	public List<Product> getListByWebsite1(Long webId, 
			int firstResult, int maxResults,boolean cacheable) ;
	
	public int deleteTagAssociation(ProductTag[] tags);

	public Product findById(Long id);

	public Product save(Product bean);

	public Product updateByUpdater(Updater<Product> updater);

	public Product deleteById(Long id);
	
	public List<Product> getLimitProduct(Long id);
	
	public Pagination getPageByCategoryChannel(Long storeId,Long brandRadio,String brandId, Long ctgId,Long storeCategoryId,String[] names,String[] values,
			int orderBy,Double startPrice,Double endPrice, int pageNo, int pageSize, boolean cacheable);

	
	public List<Product> getHistoryProduct(HashSet<Long> set,Integer count);
	
	public List<Product> getCountProduct(Long webId, Long ctgId);

}